package com.github.ghsea.retry;

import java.util.Objects;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author guhai
 */
@Getter
@NoArgsConstructor
@Setter
public class RetryableEvent<T> {

    private T actionParamBean;

    /**
     * 事件key，不约束唯一，只为后续查找日志方便，这里建议使用业务key。例如用户业务使用userCode，运单业务使用orderCode
     */
    private Long key;

    private Long key2;

    public RetryableEvent(T event, Long key) {
        Objects.nonNull(event);
        this.actionParamBean = event;
        this.key = key;
    }

    public T getActionParamBean() {
        return actionParamBean;
    }

    public RetryableEvent<T> setActionParamBean(T actionParamBean) {
        this.actionParamBean = actionParamBean;
        return this;
    }

    public Long getKey() {
        return key;
    }

    public RetryableEvent<T> setKey(Long key) {
        this.key = key;
        return this;
    }

    public Long getKey2() {
        return key2;
    }

    public RetryableEvent<T> setKey2(Long key2) {
        this.key2 = key2;
        return this;
    }
}
